<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/5/31
 * Time: 9:54
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\model;

class MallCommission extends Base
{
    /**
     * 查询剩余佣金
     * @param int $cate_id
     * @return MallCommission|array|mixed|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getPartnerBySurplus(int $cate_id = 0)
    {
        return $this->field('sum(commission) as money')
            ->where('cate_id', $cate_id)
            ->where('status', 1)
            ->find();
    }
}